package com.net.xpay.common.validator;



import com.google.common.base.Strings;
import com.net.xpay.common.model.UserRegistrationModel;
import com.net.xpay.core.constant.PoseidonErrorCode;
import com.net.common.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 用户备案参数验证
 */
@Slf4j
@Component
public class UserRegistrationValidator {

    public void validateUserRegistration(UserRegistrationModel model){
        if (model.getUserId() == null){
            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"用户ID不可为空");
        }
//        if (model.getServiceRatio() == null){
//            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"费率不可为空");
//        }
        if (Strings.isNullOrEmpty(model.getBusinessLicense())){
            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"法人营业执照不可为空");
        }
//        if (Strings.isNullOrEmpty(model.getIdCardFront())){
//            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"法人身份证正面照不可为空");
//        }
//        if (Strings.isNullOrEmpty(model.getIdCardBack())){
//            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"法人身份证反面照不可为空");
//        }
        if (Strings.isNullOrEmpty(model.getBizSceneDesc())){
            throw new BusinessException(PoseidonErrorCode.PARAMETER_ILLEGAL,"业务场景说明书加公章不可为空");
        }

    }
}
